main()
{
 local r;
 repeat
   { print("Input a positive number : ");
     r = val(input()); }
  until (r > 0.0);
  print("The number of integer lattice points within\n",
           "a circle of radius ",r," is ",f(r),".\n");
}

f(r)
{ local s,n,x,u;
   s = 0;
   u = n = 1;
   while ((x = floor(r*r/(n++))) > 0) 
       { s += u*x; u = -u; }
   return 1+4*s;}
